﻿// -------------------------------------------------------------------------
//    @FileName         :    NFMirrorSessionMgr.h
//    @Author           :    Gao.Yi
//    @Date             :    2025-08-29
//    @Email			:    445267987@qq.com
//    @Module           :    NFMirrorSessionMgr
//    @Desc             :
//
// -------------------------------------------------------------------------

#pragma once

#include "NFComm/NFObjCommon/NFObject.h"
#include "NFComm/NFShmStl/NFShmHashMap.h"
#include "NFLogicCommon/NFLogicShmTypeDefines.h"

#define MAX_ROLE_MIRROR_SESSION_NUM 10240

class NFMirrorSessionMgr : public NF_OBJECT_GLOBAL_TEMPLATE_MACRO(NFMirrorSessionMgr, EOT_LOGIC_MIRROR_SESSION_MGR_ID, NFObject)
public:
    NFMirrorSessionMgr();
    ~NFMirrorSessionMgr() override;
    int CreateInit();
    int ResumeInit();
public:
    int OnTimer(int timeId, int callCount) override;
public:
    int GetLockedLoginMirrorSessionId(uint64_t roleId);
    int LockLoginMirror(uint64_t roleId, int sessionId);
    int UnLockLoginMirror(uint64_t roleId, int sessionId);
private:
    NFShmHashMap<uint64_t, int, MAX_ROLE_MIRROR_SESSION_NUM> m_roleIdToSessionMap; // roleId -> sessionId
};